package com.lagou.edu.user.remote;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lagou.edu.user.dto.UserDTO;
import com.lagou.edu.user.param.UserQueryParam;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * 系统用户管理
 */
@FeignClient(name = "edu-user-boot", path = "/user")
public interface UserRemoteService {

    /**
     * 根据userId获取用户信息
     */
    @GetMapping("/getUserById")
    UserDTO getUserById(@RequestParam("userId") Integer userId);

    /**
     * 根据phone获取用户信息
     */
    @GetMapping("/getUserByPhone")
    UserDTO getUserByPhone(@RequestParam("phone") String phone);

    /**
     * 判断用户是否注册
     */
    @GetMapping("/isRegister")
    boolean isRegister(@RequestParam("phone") String phone);

    /**
     * 分页查询课程信息
     */
    @GetMapping("/getPagesCourses")
    Page<UserDTO> getPagesUsers(@RequestParam("currentPage") Integer currentPage,
                                @RequestParam("pageSize") Integer pageSize);

    /**
     * 保存用户信息
     */
    @PostMapping("/saveUser")
    UserDTO saveUser(@RequestBody UserDTO userDTO);

    /**
     * 修改用户信息
     */
    @PostMapping("/updateUser")
    boolean updateUser(@RequestBody UserDTO userDTO);

    /**
     * 是否修改用户密码
     */
    @GetMapping("/isUpdatedPassword")
    boolean isUpdatedPassword(@RequestParam("userId") Integer userId);

    /**
     * 设置密码
     */
    @PostMapping("/setPassword")
    boolean setPassword(@RequestParam("userId") Integer userId, @RequestParam("password") String password, @RequestParam("configPassword") String configPassword);

    /**
     * 修改密码
     */
    @PostMapping("/updatePassword")
    boolean updatePassword(@RequestParam("userId") Integer userId, @RequestParam("oldPassword") String oldPassword, @RequestParam("newPassword") String newPassword, @RequestParam("configPassword") String configPassword);

    /**
     * 分页获取用户信息
     */
    @PostMapping(value = "/getUserPages")
    Page<UserDTO> getUserPages(@RequestBody UserQueryParam userQueryParam);

    /**
     * 用户是否停用
     */
    @PostMapping("/forbidUser")
    boolean forbidUser(@RequestParam("userId") Integer userId);

}
